#ifndef RTTISTORAGE_H_
#define RTTISTORAGE_H_

#include <boost/noncopyable.hpp>


namespace GRAPH_SUPPORT_NS
{
namespace utils
{

/**
 * label interface
 */
class IRTTIStorageLabel
{
public:
	virtual ~IRTTIStorageLabel()
	{
	}
};

template< typename T >
class IRTTIStorage : public IRTTIStorageLabel
{
public:
	virtual T * get() = 0;
};

class NOPSuperT
{
};

template< typename T >
class RTTIStorage : public virtual IRTTIStorage< T >
{
public:
	/**
	 * doesn't own pointer
	 */
	RTTIStorage( T * dataPtr )
		: dataPtr( dataPtr )
	{
	}

	virtual T * get()
	{
		return dataPtr;
	}

private:
	T * dataPtr;
};

template< typename T >
class RTTICpStorage : public virtual IRTTIStorage< T >
{
// TODO: warning
public:
	RTTICpStorage( const T & data )
		: dataCopy( data )
	{
	}

	virtual T * get()
	{
		return & dataCopy;
	}

private:
	T dataCopy;
};

}
}

#endif /* RTTISTORAGE_H_ */
